import request from '@/utils/request';

/**
 * 添加标签
 * @param {Object} tag
 * @return {void}
 */
export function add(tag) {
  return request({
    url: '/txs/base_tags',
    method: 'post',
    data: tag,
  });
}

/**
 * 修改标签
 * @param {Object} tag
 * @return {void}
 */
export function update(tag) {
  return request({
    url: '/txs/base_tags',
    method: 'put',
    data: tag,
  });
}

/**
 * 删除标签
 * @param {number} id 主键ID
 * @return {void}
 */
export function del(id) {
  return request({
    url: '/txs/base_tags',
    method: 'delete',
    params: { id },
  });
}

/**
 * 根据主键ID查询标签
 * @param {number} id 主键ID
 * @return {Object}
 */
export function getOne(id) {
  return request({
    url: '/txs/base_tags',
    method: 'get',
    params: { id },
  });
}

/**
 * 分页查询标签
 * @param {Object} params 页码, 查询关键字等
 * @return {Object}
 */
export function getPage(params) {
  return request({
    url: '/txs/base_tags/page',
    method: 'get',
    params: params,
  });
}

/**
 * 查询顾客的性格标签
 * <p>
 * @param {number} cid 顾客主键ID
 * @return {Promise}
 */
export function getPersonality(cid) {
  return request({
    url: '/txs/tag_personality',
    method: 'get',
    params: { cid },
  });
}
